package com.legal.app.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.legal.common.annotation.Excel;
import com.legal.common.core.domain.BaseEntity;

import java.util.Map;

/**
 * 小程序用户对象 z_user
 * 
 * @author Ale
 * @date 2025-05-30
 */
@EqualsAndHashCode(callSuper = true)
@Data
@TableName("z_user")
public class User extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 用户ID */
    private Long id;

    /** 微信OpenID */
    @Excel(name = "微信OpenID")
    private String wechatOpenid;

    /** 手机号（唯一，用于登录） */
    @Excel(name = "手机号", readConverterExp = "唯=一，用于登录")
    private String phoneNumber;

    /** 密码（加密存储） */
    @Excel(name = "密码", readConverterExp = "加=密存储")
    private String encodeCipher;

    /** 昵称 */
    @Excel(name = "昵称")
    private String nickName;

    /** 头像地址 */
    @Excel(name = "头像地址")
    private String avatarUrl;

    /** 用户类型(1=普通用户,2=律师,3=管理员) */
    @Excel(name = "用户类型(1=普通用户,2=律师,3=管理员)")
    private Long userType;



    /**
     * 正确方式：在字段上使用@TableField(exist = false)
     * 声明该字段不映射到数据库表
     */
    @TableField(exist = false)
    private Map<String, Object> params;
    // 覆盖BaseEntity的params字段
    @Override
    public Map<String, Object> getParams() {
        return super.getParams();
    }

    @Override
    public void setParams(Map<String, Object> params) {
        super.setParams(params);
    }
//    /**
//     * 排除BaseEntity中的params字段（数据库中不存在）
//     * 保持与父类一致的Map类型，使用exist = false声明不映射到数据库
//     */
//    @TableField(exist = false)
//    private Map<String, Object> params;  // 与父类类型一致
//
//    // 重写getter/setter，确保方法签名与父类一致
//    @Override
//    public Map<String, Object> getParams() {
//        return super.getParams();
//    }
//
//    @Override
//    public void setParams(Map<String, Object> params) {
//        super.setParams(params);
//    }

    /** 国籍 */
    @Excel(name = "国籍")
    private String nationality;

    /** 性别(0=未知,1=男,2=女) */
    @Excel(name = "性别(0=未知,1=男,2=女)")
    private Long gender;

    /** 语言 */
    @Excel(name = "语言")
    private String language;

    /** 地址 */
    @Excel(name = "地址")
    private String address;

    /** 真实姓名 */
    @Excel(name = "真实姓名")
    private String realName;

    /** 身份证号（加密存储） */
    @Excel(name = "身份证号", readConverterExp = "加=密存储")
    private String idCard;

    /** 认证状态(0=未认证,1=已认证,2=认证中,3=认证失败) */
    @Excel(name = "认证状态(0=未认证,1=已认证,2=认证中,3=认证失败)")
    private Long certificationStatus;

    /** 是否被拉黑(0=正常,1=已拉黑) */
    @Excel(name = "是否被拉黑(0=正常,1=已拉黑)")
    private Long isBlocked;

    /** 用户状态(0=注销,1=正常,2=冻结) */
    @Excel(name = "用户状态(0=注销,1=正常,2=冻结)")
    private Long status;

    public void setId(Long id) 
    {
        this.id = id;
    }

    public Long getId() 
    {
        return id;
    }

    public void setWechatOpenid(String wechatOpenid) 
    {
        this.wechatOpenid = wechatOpenid;
    }

    public String getWechatOpenid() 
    {
        return wechatOpenid;
    }

    public void setPhoneNumber(String phoneNumber) 
    {
        this.phoneNumber = phoneNumber;
    }

    public String getPhoneNumber() 
    {
        return phoneNumber;
    }

    public void setEncodeCipher(String encodeCipher) 
    {
        this.encodeCipher = encodeCipher;
    }

    public String getEncodeCipher() 
    {
        return encodeCipher;
    }

    public void setNickName(String nickName) 
    {
        this.nickName = nickName;
    }

    public String getNickName() 
    {
        return nickName;
    }

    public void setAvatarUrl(String avatarUrl) 
    {
        this.avatarUrl = avatarUrl;
    }

    public String getAvatarUrl() 
    {
        return avatarUrl;
    }

    public void setUserType(Long userType) 
    {
        this.userType = userType;
    }

    public Long getUserType()
    {
        return userType;
        //--------------------------2025/6/17
    }

    public void setNationality(String nationality) 
    {
        this.nationality = nationality;
    }

    public String getNationality() 
    {
        return nationality;
    }

    public void setGender(Long gender) 
    {
        this.gender = gender;
    }



    public void setLanguage(String language) 
    {
        this.language = language;
    }

    public String getLanguage() 
    {
        return language;
    }

    public void setAddress(String address) 
    {
        this.address = address;
    }

    public String getAddress() 
    {
        return address;
    }

    public void setRealName(String realName) 
    {
        this.realName = realName;
    }

    public String getRealName() 
    {
        return realName;
    }

    public void setIdCard(String idCard) 
    {
        this.idCard = idCard;
    }

    public String getIdCard() 
    {
        return idCard;
    }

    public void setCertificationStatus(Long certificationStatus) 
    {
        this.certificationStatus = certificationStatus;
    }


    public void setIsBlocked(Long isBlocked) 
    {
        this.isBlocked = isBlocked;
    }

    public Long getIsBlocked() 
    {
        return isBlocked;
    }

    public void setStatus(Long status) 
    {
        this.status = status;
    }

    public Long getStatus() 
    {
        return status;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("id", getId())
            .append("wechatOpenid", getWechatOpenid())
            .append("phoneNumber", getPhoneNumber())
            .append("encodeCipher", getEncodeCipher())
            .append("nickName", getNickName())
            .append("avatarUrl", getAvatarUrl())
            .append("userType", getUserType())
            .append("nationality", getNationality())
            .append("gender", getGender())
            .append("language", getLanguage())
            .append("address", getAddress())
            .append("realName", getRealName())
            .append("idCard", getIdCard())
            .append("certificationStatus", getCertificationStatus())
            .append("isBlocked", getIsBlocked())
//            .append("createTime", get())
//            .append("updateTime", getUpdateTime())
            .append("status", getStatus())
            .toString();
    }
}
